home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’96 / Talking Telnet / source / config / IC / ICAPI.h next >
Text File  |  1996-06-22  |  5KB  |  117 lines

  1. /*
  2.     The canonical Internet Config interface is defined in Pascal.  These headers have
  3.     not been thoroughly tested.  If there is a conflict between these headers and the
  4.     Pascal interfaces, the Pascal should take precedence.
  5. */
  6.  
  7.  
  8. #ifndef __ICAPI__
  9. #define __ICAPI__
  10.  
  11. #ifndef __TYPES__
  12. #include <Types.h>
  13. #endif
  14.  
  15. #ifndef __FILES__
  16. #include <Files.h>
  17. #endif
  18.  
  19. #ifndef __ICTYPES__
  20. #include <ICTypes.h>
  21. #endif
  22.  
  23.  
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27.  
  28.     pascal ICError ICStart(ICInstance *inst, OSType creator);
  29.     /* call at application initialisation */
  30.  
  31.     pascal ICError ICStop(ICInstance inst);
  32.     /* call at application termination */
  33.  
  34.     pascal ICError ICFindConfigFile(ICInstance inst, short count, ICDirSpecArrayPtr folders);
  35.     /* count is the number of ICDirSpecs that are valid in folders */
  36.     /* searches the specified folders first, then backs out to preferences folder */
  37.     /* don't you worry about how it finds the file (; */
  38.     /* you can pass nil to folders if count is 0 */
  39.  
  40.     pascal ICError ICSpecifyConfigFile(ICInstance inst, FSSpec *config);
  41.     /* for use *only* by Internet Configuration application */
  42.  
  43.     pascal ICError ICGetSeed(ICInstance inst, long *seed);
  44.     /* returns current seed for prefs file */
  45.     /* this seed changes every time a preference is modified */
  46.     /* poll this to detect preference changes by other applications */
  47.  
  48.     pascal ICError ICGetPerm(ICInstance inst, ICPerm *perm);
  49.     /* returns the permissions currently associated with this file */
  50.     /* mainly used by overriding components, applications normally */
  51.     /* know what permissions they have */
  52.  
  53.     pascal ICError ICBegin(ICInstance inst, ICPerm perm);
  54.     /* start reading/writing the preferences */
  55.     /* must be balanaced by a ICEnd */
  56.     /* do not call WaitNextEvent between this pair */
  57.     /* specify either icReadOnlyPerm or icReadWritePerm */
  58.     /* note that this may open resource files and leave them open until ICEnd */
  59.  
  60.     pascal ICError ICGetPref(ICInstance inst, ConstStr255Param key, ICAttr *attr, Ptr buf, long *size);
  61.     /* this routine may be called without a ICBegin/ICEnd pair, in which case */
  62.     /* it implicitly calls ICBegin(inst, icReadOnlyPerm */
  63.     /* given a key string, returns the attributes and the (optionally) the data for a preference */
  64.     /* key must not be the empty string */
  65.     /* if buf is nil then no data fetched and incoming size is ignored*/
  66.     /* size must be non-negative, is size of allocated space for data at buf */
  67.     /* attr and size and always set on return */
  68.     /* size is actual size of data (if key present); */
  69.     /* attr is pref attributes */
  70.      /* if icTruncatedErr then everything is valid, except you lost some data, size is size of real data*/
  71.     /* on other errors, attr is ICattr_no_change and size is 0 */
  72.  
  73.     pascal ICError ICSetPref(ICInstance inst, ConstStr255Param key, ICAttr attr, Ptr buf, long size);
  74.     /* this routine may be called without a ICBegin/ICEnd pair, in which case */
  75.     /* it implicitly calls ICBegin(inst, icReadWritePerm */
  76.     /* given a key string, sets the attributes and the data for a preference (either is optional); */
  77.     /* key must not be the empty string */
  78.     /* if buf is nil then no data stored and size is ignored, used for setting attr */
  79.     /* size must be non-negative, is size of the data at buf to store */
  80.     /* icPermErr if ICBegin was given icReadOnlyPerm */
  81.     /* icPermErr if current attr is locked, new attr is locked and buf <> nil */
  82.  
  83.     pascal ICError ICCountPref(ICInstance inst, long *count);
  84.     /* count total number of preferences */
  85.     /* if error then count is 0 */
  86.  
  87.     pascal ICError ICGetIndPref(ICInstance inst, long n, Str255 key);
  88.     /* return the key of the Nth preference */
  89.     /* n must be positive */
  90.     /* icPrefNotFoundErr if n is beyond the last preference */
  91.  
  92.     pascal ICError ICDeletePref(ICInstance inst, ConstStr255Param key);
  93.     /* delete the preference specified by key */
  94.     /* key must not be the empty string */
  95.     /* preference specified by key must be present */
  96.     /* icPrefNotFoundErr if it isn't */
  97.  
  98.     pascal ICError ICEnd(ICInstance inst);
  99.     /* stop reading/writing the preferences */
  100.  
  101.     pascal ICError ICDefaultFileName(ICInstance inst, Str63 name);
  102.     /* return the default file name */
  103.     /* the component calls this routine to set up the default internet configuration file name*/
  104.     /* this allows this operation to be intercepted by a component that has captured us */
  105.     /* it currently gets it from the component resource file */
  106.     /* the glue version is hardwired */
  107.  
  108.     pascal ICError ICGetComponentInstance(ICInstance inst, Ptr *component_inst);
  109.     /* returns noErr and the component instance that we're talking to, if we're using the component */
  110.     /* returns an error and nil if we're doing it with glue */
  111.  
  112. #ifdef __cplusplus
  113. }
  114. #endif __cplusplus
  115.  
  116. #endif
  117.